import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/**
 * 简化router文件
 * {[String]} path          定义页面路由路径
 * {[String]} name          挂在文件名字
 * {[String]} boolean       进入路由是需要登录 true为需要登录 false不需要登录
 * {[string]} url           进入路由的配置路径
 * {Object} [other={}]      路由其他参数
 * {Array}  [children=[]]   嵌套（子）路由配置
 * {Object}                 返回router可用obj
 */
function path(path, name, meta, url, other = {}, children = []) {
  return Object.assign({
    path: path,
    name: name,
    meta: meta,
    component: resolve => require(['@/views/' + url + '.vue'], resolve),
    // component: resolve => require.ensure([], () => resolve(require('views/' + url + '.vue')), 'pack'),
    children: children
  }, other)
}

export default new Router({
  mode: 'history',
  base: '/ect/wechat/',
  scrollBehavior: () => ({
    y: 0
  }),
  routes: [
    path('/operPdf', 'OperateManualPdf', { isNotLogin: true, title: '操作手册' }, 'OperateManualPdf'),
    path('/WxError', 'WxError', { isNotLogin: true, title: '抱歉，出错了' }, 'wxError'), // 非微信访问提示页
    path('/faceLogin', 'FaceLogin', { isNotLogin: true, title: '扫脸登录' }, 'login/FaceLogin'), // 扫脸登录
    path('/login', 'login', { isNotLogin: true, title: '用户登录' }, 'login/Login'), // 模拟登录页
    path('/loginTransfer', 'LoginTransfer', { isNotLogin: true, title: '登录成功' }, 'login/LoginTransfer'),
    path('/test/:regorg', 'test', { isNotLogin: true, title: '功能页' }, 'Test'), // 功能测试页
    path('/identity/:regorg', 'PersonIdentity', { isNotLogin: true, title: '个人实名认证' }, 'identity/person/PersonIdentity'),
    path('/entIdentity/:regorg', 'CompanyIdentity', { isNotLogin: true, title: '企业实名认证' }, 'identity/company/CompanyIdentity'),
    path('/identityTransfer', 'IdentityTransfer', { isNotLogin: true, title: '认证成功' }, 'identity/IdentityTransfer'),
    path('/mySetupList/:regorg', 'MySetupList', { title: '拟设立公司' }, 'cp_setup/MySetupList'),
    path('/OtherSetupList', 'OtherSetupList', { title: '拟设立公司' }, 'cp_setup/OtherSetList'),
    path('/ApplyModule', 'ApplyModule', { title: '业务菜单页' }, 'cp_setup/ApplyModule'),
    path('/baseinfo', 'CompanyBaseInfo', { title: '企业基本信息' }, 'cp_setup/CompanyBaseInfo'),
    path('/approve', 'CompanyApproved', { title: '退回意见' }, 'cp_setup/CompanyApproved'),
    path('/scope', 'CompanyScope', { title: '经营范围' }, 'cp_setup/CompanyScope'),
    path('/scopeQuery', 'ScopeQuery', { title: '经营范围搜索' }, 'cp_setup/ScopeQuery'),
    path('/investor', 'InvestorList', { title: '股东' }, 'cp_setup/investor/InvestorList'),
    path('/personInv', 'PersonInvEdit', { title: '自然人股东' }, 'cp_setup/investor/PersonInvEdit'),
    path('/entInv', 'EntInvEdit', { title: '非自然人股东' }, 'cp_setup/investor/EntInvEdit'),
    path('/selectSuped', 'CompanySuped', { title: '董监事选择' }, 'cp_setup/CompanySuped'),
    path('/memList', 'CompanyMemList', { title: '主要人员信息' }, 'cp_setup/member/CompanyMemList'),
    path('/memAdd', 'MemberAdd', { title: '添加主要人员' }, 'cp_setup/member/MemberAdd'),
    path('/memEdit', 'MemberEdit', { title: '编辑主要人员' }, 'cp_setup/member/MemberEdit'),
    path('/contact', 'contact', { title: '企业联系人' }, 'cp_setup/CompanyContact'),
    path('/FileUpload', 'FileUpload', { title: '文件上传' }, 'cp_setup/fileUpload/FileUpload'),
    path('/entSupInfo', 'CompanySupInfo', { title: '补充信息' }, 'cp_setup/CompanySupInfo'),
    path('/record', 'record', { title: '刻章备案' }, 'cp_setup/PoliceRecord'),
    path('/record_completed', 'record_completed', { title: '刻章备案' }, 'cp_setup/PoliceRecordSelect'),
    path('/RuleResult', 'RuleResult', { title: '审查结果' }, 'cp_setup/RuleResult'),
    path('/myBusi/:regorg', 'MyBusiness', { title: '我的业务' }, 'myBusiness/MyBusiness'),
    path('/Process/:gid', 'Process', { isNotLogin: true, title: '进度查看' }, 'myBusiness/BusinessDetail'),
    path('/BusinessConfirmList/:regorg', 'BusinessConfirmList', { title: '业务确认列表' }, 'confirm/BusinessConfirmList'),
    path('/BusinessConfirmProcess', 'BusinessConfirmProcess', { title: '业务确认提示' }, 'confirm/BusinessConfirmProcess'),
    path('/BusinessConfirmAuth', 'BusinessConfirmAuth', { title: '确认授权' }, 'confirm/BusinessConfirmAuth'),
    path('/BusinessConfirmPdf', 'BusinessConfirmPdf', { title: '申报材料' }, 'confirm/BusinessConfirmPdf'),
    path('/BusinessConfirmSign', 'BusinessConfirmSign', { title: '签字' }, 'confirm/BusinessConfirmSign'),
    path('/ConfirmDoBack', 'ConfirmDoBack', { title: '退回经办人' }, 'confirm/ConfirmDoBack'),
    path('*', 'blankHtml', { isNotLogin: true, title: '微信办照' }, 'Test'), // 默认页
    path('/changeTip', 'changeTip', { title: '变更登记温馨提示' }, 'change/changeTip'),
    path('/changeApply', 'changeApply', { title: '变更登记申请' }, 'change/changeApply'),
    path('/changeChoose', 'changeChoose', { title: '变更事项选择' }, 'change/changeChoose'),
    path('/changeBody', 'changeBody', { title: '变更事项主体' }, 'change/changeBody'),
    path('/changeComName', 'changeComName', { title: '企业名称' }, 'change/changeComName'),
    path('/changeComAddress', 'changeComAddress', { title: '企业住所信息' }, 'change/changeComAddress'),
    path('/changeComScope', 'changeComScope', { title: '经营范围' }, 'change/changeComScope'),
    path('/changeComTerm', 'changeComTerm', { title: '营业期限' }, 'change/changeComTerm'),
    path('/changeComUpload', 'changeComUpload', { title: '文件上传' }, 'change/changeComUpload'),
    path('/changeComContact', 'changeComContact', { title: '企业联系人' }, 'change/changeComContact'),
    path('/changeComAdd', 'changeComAdd', { title: '补充信息' }, 'change/changeComAdd'),
    path('/myService', 'myService', { title: '我的业务' }, 'myService/myService'),
    path('/myServiceDetail', 'myServiceDetail', { title: '进度查看' }, 'myService/myServiceDetail'),
  ]
})
